//
//  ViewController.m
//  WMEMusic
//
//  Created by 恩叔 on 16/4/10.
//  Copyright © 2016年 enshu. All rights reserved.
//

#import "ViewController.h"
#import "WMEAudioManager.h"
@interface ViewController ()

@end

static BOOL isPlayer = YES;
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(100, 100, 100, 50);
    [button setTitle:@"播放" forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)buttonAction:(UIButton *)button
{
    if (isPlayer == YES) {
        [[WMEAudioManager defaultManager] playingWithURL:@"http://zhangmenshiting.baidu.com/data2/music/137020642/137020642.mp3?xcode=846916669b35dcde5fa4084c7da1aa86"];
        isPlayer = NO;
    }else {
        [[WMEAudioManager defaultManager] pause];
        isPlayer = YES;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
